﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EasyCore.Configurations.Attributes
{
    /// <summary>
    /// 选项配置特性
    /// </summary>
    [AttributeUsage(AttributeTargets.Class)]
    public class OptionsSettingAttribute:Attribute
    {
        /// <summary>
        /// 构造函数
        /// </summary>
        public OptionsSettingAttribute()
        {
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="path"></param>
        public OptionsSettingAttribute(string path)
        {
            Path = path;
        }

        /// <summary>
        /// 配置节路径
        /// </summary>
        public string Path { get; private set; }

        /// <summary>
        /// 设置配置节路径
        /// </summary>
        /// <param name="path"></param>
        public void SetPath(string path)
        {
            if (string.IsNullOrWhiteSpace(Path)) Path = path;
        }
    }
}
